//
//  SyncManager.h
//  leo
//
//  Created by 常艳 on 15/8/26.
//  Copyright (c) 2015年 mdx. All rights reserved.
//

#import <Foundation/Foundation.h>
#import "HttpRequester.h"
#import "common.h"
#import "DataManager.h"
#import "Tooler.h"
#import "User.h"
#import "Watch.h"
#import "Manager.h"
#import "Binder.h"
#import "Fence.h"
#import "Location.h"
#import "Contact.h"
#import "Chat.h"
#import "Silent.h"
#import "Reminder.h"
#import "Setting.h"
#import "Advice.h"
#import "Version.h"
#define SyncManager_TAG @"SyncManager-----------------------"
@interface SyncManager : NSObject
@property (nonatomic,strong) HttpRequester *theRequeseter;
@property (nonatomic,strong) DBHelper *theDbHelper;
@property (nonatomic,strong) DataManager *theManager;
+(SyncManager *)sharedSingleton;
//注册绑定相关接口
-(void)getCheckCode:(NSString *)phone type:(int) type completion:(void (^)(SyncResult result,NSDictionary *retValue,NSString * description))callback;
-(void)verifySmsCode:(NSString *)phone smsCode:(NSString *)code completion:(void (^)(SyncResult result,NSDictionary *retValue,NSString *description))callback;
-(void)registerPhone:(NSString *)phone pass:(NSString *)pass nickname:(NSString *)nickname completion:(void (^)(SyncResult result,NSDictionary *retValue,NSString *description))callback;
-(void)bindDevice:(NSString *)deviceUid bindCode:(NSString *)bindCode   alias:(NSString *)alias completion:(void (^)(SyncResult result,NSDictionary *retValue,NSString *description))callback;
-(void)loginPhone:(NSString *)phone pass:(NSString *)pass completion:(void (^)(SyncResult result,NSDictionary *retValue,NSString *description))callback;
-(void)resetPwd:(NSString *)phoneNum password:(NSString *)password smsCode:(NSString *)smsCode completion:(void (^)(SyncResult result,NSDictionary *retValue,NSString *description))callback;
-(void)bindConfirm:(NSString *)deviceUid viceAdminUid:(NSString *) viceAdminUid nickName:(NSString *)nickName result:(BOOL) result  randomCode:(NSString *)randomCode alias:(NSString *)alias completion:(void (^)(SyncResult result,NSDictionary *retValue,NSString *description))callback;//modify 1230
-(void) unbindDevice:(Watch *)watch  completion:(void (^)(SyncResult result,NSDictionary *retValue,NSString *description))callback;//modify 1230
-(void)deleteViceAdmin:(NSString *)deviceUid viceAdminUid:(NSString *)viceAdminUid  completion:(void (^)(SyncResult result,NSDictionary *retValue,NSString *description)) callback;
-(void)inviteViceAdmin:(NSString *)deviceUid vaaccount:(NSString *)vaaccount completion:(void (^)(SyncResult result,NSDictionary *retValue,NSString *description))callback;
//上传、下载数据相关接口
-(void)getBoundUsers:(NSString *)deviceUid completion:(void (^)(SyncResult result,NSDictionary *retValue,NSString *description))callback;
-(void)getBoundDevices:(void (^)(SyncResult result,NSDictionary *retValue,NSString *description))callback;


//定位相关API
-(void)setLocateParameters:(NSString *)deviceUid reportInterval:(int) reportInterval sampleInterval:(int)sampleInterval completion:(void (^)(SyncResult result,NSDictionary *retValue,NSString *description))callback;//没有用，作废
-(void)getLocateParameters:(NSString *)deviceUid  completion:(void (^)(SyncResult result,NSDictionary *retValue,NSString *description))callback;//没有用，作废
-(void)addGeoFence:(NSString *)deviceUid fence:(Fence *)fence completion:(void (^)(SyncResult result,NSDictionary *retValue,NSString *description))callback;
-(void)setGeoFence:(NSString *)deviceUid fence:(Fence *)fence completion:(void (^)(SyncResult result,NSDictionary *retValue,NSString *description))callback;
-(void)getGeoFences:(NSString *)deviceUid completion:(void (^)(SyncResult result,NSDictionary *retValue,NSString *description))callback;
-(void)deleteGeoFence:(NSString *)deviceUid fenceId:(NSString *)fenceId completion:(void (^)(SyncResult result,NSDictionary *retValue,NSString *description))callback;
-(void)getMotionTrack:(NSString *)deviceUid withStartTime:(NSString *)startTime andEndTime:(NSString *)endTime completion:(void (^)(SyncResult result,NSDictionary *retValue,NSString *description))callback;
-(void)getLatestPosition:(NSString *)deviceUid completion:(void (^)(SyncResult result,NSDictionary *retValue,NSString *description))callback;
-(void)locateImmediately:(NSString *)deviceUid completion:(void (^)(SyncResult result,NSDictionary *retValue,NSString *description))callback;//不用了，作废

// 联系人相关API
-(void)addWatchContact:(Contact *)contact  completion:(void (^)(SyncResult result,NSDictionary *retValue,NSString *description))callback;
-(void)setWatchContact:(Contact *)contact completion:(void (^)(SyncResult result,NSDictionary *retValue,NSString *description))callback;
-(void)deleteContact:(NSString *)deviceUid contactId:(NSString *)contactId completion:(void (^)(SyncResult result,NSDictionary *retValue,NSString *description))callback;
-(void)getWatchContact:(NSString *)deviceUid completion:(void (^)(SyncResult result,NSDictionary *retValue,NSString *description))callback;

//用户及手表信息设置相关API
-(void)setUserInfo:(void (^)(SyncResult result,NSDictionary *retValue,NSString *description))callback;
-(void)setUserInfo1:(void (^)(SyncResult result,NSDictionary *retValue,NSString *description))callback;
-(void)setWatchInfo:(Watch *)watch completion:(void (^)(SyncResult result,NSDictionary *retValue,NSString *description))callback;
-(void)updateRelation:(NSString *)deviceUid alias:(NSString *)alias completion:(void (^)(SyncResult result,NSDictionary *retValue,NSString *description))callback;

//聊天相关API
-(void)uploadGroupChatRecord:(Chat *)chat completion:(void (^)(SyncResult result,NSDictionary *retValue,NSString *description))callback;
-(void)uploadSingleChatRecord:(Chat *)chat completion:(void (^)(SyncResult result,NSDictionary *retValue,NSString *description))callback;
-(void)getSingleChatRecords:(NSString *)targetUid seqIdBegin:(NSString *)seqIdBegin limit:(int)limit deviceUid:(NSString *)deviceUid completion:(void (^)(SyncResult result,NSDictionary *retValue,NSString *description))callback;
-(void)getGroupChatRecords:(int)groupId seqIdBegin:(NSString *)seqIdBegin limit:(int)limit deviceUid:(NSString *)deviceUid completion:(void (^)(SyncResult result,NSDictionary *retValue,NSString *description))callback;
-(void)getAudio:(NSString *)audioHash theUid:(NSString *)theUid type:(fileType)type otherId:(NSString *)otherId;
-(void)getAudioByUrl:(NSString *)audioHash url:(NSString *)url theUid:(NSString *)theUid type:(fileType)type otherId:(NSString *)otherId;

//静音时段相关API
-(void)addSilentPeriod:(NSString *)deviceUid silent:(Silent *)silent completion:(void (^)(SyncResult result,NSDictionary *retValue,NSString *description))callback;
-(void)setSilentPeriod:(NSString *)deviceUid silent:(Silent *)silent completion:(void (^)(SyncResult result,NSDictionary *retValue,NSString *description))callback;
-(void)deleteSilent:(NSString *)deviceUid silentId:(NSString *)silentId completion:(void (^)(SyncResult result,NSDictionary *retValue,NSString *description))callback;
-(void)getSilent:(NSString *)deviceUid completion:(void (^)(SyncResult result,NSDictionary *retValue,NSString *description))callback;

//提醒相关API
-(void)addReminder:(NSString *)deviceUid reminder:(Reminder *)reminder completion:(void (^)(SyncResult result,NSDictionary *retValue,NSString *description))callback;
-(void)setReminder:(NSString *)deviceUid reminder:(Reminder *)reminder completion:(void (^)(SyncResult result,NSDictionary *retValue,NSString *description))callback;
-(void)deleteReminder:(NSString *)deviceUid reminderId:(NSString *)reminderId completion:(void (^)(SyncResult result,NSDictionary *retValue,NSString *description))callback;
-(void)getReminders:(NSString *)deviceUid completion:(void (^)(SyncResult result,NSDictionary *retValue,NSString *description))callback;

//新增的API
//APP向手表发送指令
-(void)sendCommand:(NSString *)deviceUid type:(CommandType)type watchParams:(NSString *)watchParams completion:(void (^)(SyncResult result,NSDictionary *retValue,NSString *description))callback;
//获取手表状态数据
-(void)getWatchData:(NSString *)deviceUid completion:(void (^)(SyncResult result,NSDictionary *retValue,NSString *description))callback;
//设置手表参数
-(void)updateSettingParameters:(NSString *)deviceUid  Setting:(Setting *)setting completion:(void (^)(SyncResult result,NSDictionary *retValue,NSString *description))callback;
//获取手表参数
-(void)getSettingParameters:(NSString *)deviceUid  completion:(void (^)(SyncResult result,NSDictionary *retValue,NSString *description))callback;
//问题反馈
-(void)feedback:(Advice *)advice completion:(void (^)(SyncResult result,NSDictionary *retValue,NSString *description))callback;
//检测app新版本
-(void)checkAppVersion:(void (^)(SyncResult result,NSDictionary *retValue,NSString *description))callback;
//检测手表新版本
-(void)deviceUpgrade:(NSString *)deviceUid completion:(void (^)(SyncResult result,NSDictionary *retValue,NSString *description))callback;
//把副管理员设置为紧急联系人
-(void)updateViceAdminInfo:(NSString *)deviceUid viceAdmin:(Manager *)viceAdmin completion:(void (^)(SyncResult result,NSDictionary *retValue,NSString *description))callback;
-(void)confirmPushMessage:(NSString *)rid completion:(void (^)(SyncResult result,NSDictionary *retValue,NSString *description))callback;
-(void)setTcpDisconnect:(void (^)(SyncResult result,NSDictionary *retValue,NSString *description))callback;
-(void)phoneLogout:(void (^)(SyncResult result,NSDictionary *retValue,NSString *description))callback;
-(void)getUserInfo:(void (^)(SyncResult result,NSDictionary *retValue,NSString *description))callback;
-(void)getWatchPhotos;
-(void)getManagerPhotos:(NSString *)deviceUid;
-(void)getContactPhotos:(NSString *)deviceUid;
@end
